
#include <Volume.h>

#define TSPS_PER_OZ 3
#define TBSPS_PER_TSP 4
#define UNITS_PER_TBSP 1

const UnitType UnitVolume::typeVolume;

UnitVolume::UnitVolume(const int valueInBaseUnit, const UnitType& unitType, const char* unitName)
  : Unit(valueInBaseUnit, unitType, unitName)
{
}

Unit& UnitVolume::getOz()
{
    static UnitVolume Oz(TSPS_PER_OZ * TBSPS_PER_TSP, typeVolume, "OZ");
    return Oz;
}

Unit& UnitVolume::getTsp()
{
    static UnitVolume Tsp(TBSPS_PER_TSP, typeVolume, "TSP");
    return Tsp;
}

Unit& UnitVolume::getTbsp()
{
    static UnitVolume Tbsp(UNITS_PER_TBSP, typeVolume, "TBSP");
    return Tbsp;
}

Unit& UnitVolume::getBaseUnit() const
{
    return getTbsp();
}
